package com.io;

import java.io.*;

public class PipedWriterReaderDemo01 {

    public static void main(String[] args) throws IOException {

        PipedReader pr = new PipedReader();
        PipedWriter pw = new PipedWriter(pr);

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("d:\\dev\\1\\fw.txt")));
        String line=null;
        char[] buff = new char[1024];
        int len=-1;
        while((line=bufferedReader.readLine())!=null) {
            pw.write("把从文件读取一行的数据写到字符管道"+line);
            len=pr.read(buff);
            System.out.println("从管道中读出: "+new String(buff,0,len));
        }
        bufferedReader.close();


    }
}
